package com.wskj.insuranceweb.reporter.mapper;

import com.wskj.insuranceweb.reporter.pojo.*;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
@Mapper
public interface AcceptMapper {
    List<Accept> showList(@Param("report") String report, @Param("customernumber") String customernumber);
    @Insert("insert into accept values(seq_accept.nextval,#{report},#{claimstatus},#{customernumber},to_date(#{reportdate},'yyyy-MM-dd'),#{applytype},#{operator},#{investigation},to_date(#{accidentdate},'yyyy-MM-dd'),#{claimstatu},sysdate,null,null,'工作池',null)")
    void addAccept(Accept accept);
    @Select("select * from accept where id = #{0}")
    Accept findAcceptById(String id);
    @Update("update accept set waitcause = #{name},pond = '等待池' where id=#{id}")
    void updateById(@Param("id") String id, @Param("name") String name);

    List<Accept> findAccept();
    @Update("update accept set investigation = '已发起调查' where id=#{0}")
    void updateInvestigation(String id);
    @Update("update accept set investigation = '调查完毕' where customernumber = #{0}")
    void updateByCust(String customernumber);
    @Update("update accept set waitcause = '等待客户提供资料' where customernumber = #{0}")
    void updateCauseByCust(String cust);
    @Update("update accept set pond = '工作池' where customernumber = #{0}")
    void updateCByCust(String cust);
    @Update("update accept set pond = '暂停池',stopcause = '理赔材料不全',suspenddate = sysdate where customernumber = #{0}")
    void editpond(String cust);

    List<Accept> findAcceptBySuspend();
    @Update("update accept set pond = '等待池' where  customernumber = #{0}")
    void returnPool(String cust);

    Accept getAccept(String cust);
    @Delete("delete from accept where customernumber = #{0}")
    void deleteAccept(String cust);
    @Insert("insert into claim values(#{claim},#{aviation},#{money},#{customernumber})")
    void insertClaim(Claim claim);
    @Select("select * from claim where customernumber = #{0}")
    Claim findClaim(String cust);
    Backuparea findBackuparea(String reporter);
    @Update("update accept set reportdate = to_date(#{reportdate},'yyyy-MM-dd'),accidentdate =  to_date(#{accidentdate},'yyyy-MM-dd') where report = #{report}")
    void update(Backuparea b);
    @Insert("insert into modifycause values(#{report},#{empolyeename},#{editcause},sysdate)")
    void addModifycause(Modifycause modifycause);
    @Select("select * from modifycause where report = #{0}")
    List<Modifycause> findModifycause(String reporter);
    @Update("update accept set claimstatu = '审批' where report = #{0}")
    void editconcl(String report);
    @Insert("insert into conclusion values(#{conclusion},#{auditopinion},#{specialnote},#{report})")
    void addConclusion(Conclusion conclusion);
    @Update("update accept set claimstatu = '审核不通过' where report = #{0}")
    void editclaim(String report);

    List<Accept> AcceptList(@Param("report") String report, @Param("customernumber") String customernumber);
    @Select("select * from conclusion where report = #{0}")
    Conclusion getConclusion(String report);
    @Update("update accept set claimstatu = '审批完毕' where report = #{0}")
    void updateClaim(String report);
    @Insert("insert into examine values(#{report},#{examinecontent},#{examinesion},#{nocause})")
    void addExamine(Examine examine);
}
